<template>
  <div class="container">
    <!-- 基础信息区域 -->
    <div style="display: flex; justify-content: end;margin-bottom: 10px;">
      <el-button type="primary" @click="goToUserInfo()">编辑</el-button>
    </div>
    <div class="info-section">
      <div class="header">
        <div class="title-wrapper">
          <div class="blue-line"></div>
          <h3>基础信息</h3>
        </div>
      </div>
      <div class="info-content">
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">教职工姓名：</div>
            <div class="info-value">{{ dataForm.userName || '暂无数据' }}</div>
          </div>
          <div class="info-item">
            <div class="info-label">身份证号：</div>
            <div class="info-value">{{ dataForm.idCard || '暂无数据' }}</div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">性别：</div>
            <div class="info-value">{{ dataForm.sex === "0" ? '男':'女' || '暂无数据' }}</div>
          </div>
          <div class="info-item">
            <div class="info-label">出生日期：</div>
            <div class="info-value">{{ dataForm.birthDate || '暂无数据' }}</div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">手机号：</div>
            <div class="info-value">{{ dataForm.phonenumber || '暂无数据' }}</div>
          </div>
          <div class="info-item">
            <div class="info-label">邮箱：</div>
            <div class="info-value"> {{ dataForm.email || '暂无数据' }}</div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">证件照：</div>
            <div class="info-value" style="color:#1990FF">查看照片</div>
          </div>
          <div class="info-item">
            <div class="info-label">执教时间：</div>
            <div class="info-value">暂无数据</div>
          </div>
        </div>
      </div>
    </div>

    <!-- 工作信息区域 -->
    <div class="info-section">
      <div class="header">
        <div class="title-wrapper">
          <div class="blue-line"></div>
          <h3>工作信息</h3>
        </div>
      </div>
      <div class="info-content">
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">所在院系：</div>
            <div class="info-value">{{ dataForm.deptName || '暂无数据'  }}/{{ dataForm.majorName || '暂无数据'  }}</div>
          </div>
          <div class="info-item">
            <div class="info-label">职称：</div>
            <div class="info-value">{{ dataForm.title || '暂无数据'  }}</div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">获得职业证书名称：</div>
            <div class="info-value">{{ dataForm.certificateName || '暂无数据'  }}</div>
          </div>
          <div class="info-item">
            <div class="info-label">证书获取时间：</div>
            <div class="info-value">{{ dataForm.certificateDate || '暂无数据'  }}</div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">证书类型：</div>
            <div class="info-value">{{ dataForm.certificateTypeName || '暂无数据'  }}</div>
          </div>
          <div class="info-item">
            <div class="info-label">学历：</div>
            <div class="info-value">{{ dataForm.educationName || '暂无数据'  }}</div>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">专业：</div>
            <div class="info-value">{{ dataForm.majorName || '暂无数据'  }}</div>
          </div>
          <div class="info-item full-width">
            <div class="info-label">简历信息：</div>
            <div class="info-value">
              <el-table :data="dataForm.staffExperiencesList" style="width: 100%" :border="false">
                <el-table-column type="index" width="50" label="序号" align="center"></el-table-column>
                <el-table-column prop="date" label="起止时间" align="center">
                  <template slot-scope="scope">
                    {{ scope.row.startDate }} ~ {{ scope.row.endDate }}
                  </template>
                </el-table-column>
                <el-table-column prop="organization" label="单位名称" align="center"></el-table-column>
                <el-table-column prop="position" label="专业方向/职务" align="center"></el-table-column>
              </el-table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getInfo } from '@/api/login'

export default {
  data() {
    return {
      dataForm: {},
      tableData: []
    }
  },
  created() {
    this.getUserInfo();
  },
  methods: {
    getUserInfo() {
      getInfo().then(res => {
        this.dataForm = res.user
      });
    },
    goToUserInfo() {
      this.$router.push('/user/profile');
    }
  }
}
</script>

<style scoped lang="scss">
::v-deep .el-table td.el-table__cell{
  border-bottom: none !important;
}
::v-deep .el-table::before{
  background-color: transparent !important;
}
.container {
  margin: 12px;
}
/* 信息区块样式 */
.info-section {
  margin-bottom: 12px;
  padding: 16px;
  background-color: #FFFFFF;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.info-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* 标题样式 */
.header {
  margin-bottom: 20px;
  padding-bottom: 8px;
}

.title-wrapper {
  display: flex;
  align-items: center;
}

.blue-line {
  width: 4px;
  height: 24px;
  background-color: #1E62FF;
  margin-right: 12px;
  border-radius: 2px;
}

.header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
  font-weight: 600;
}

/* 内容区域样式 */
.info-content {
  width: 100%;
  padding: 0 90px;
}

/* 行样式 */
.info-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.info-row:last-child {
  margin-bottom: 0;
}

/* 项样式 */
.info-item {
  flex: 1;
  min-width: 300px;
  display: flex;
  margin-bottom: 12px;
  padding-right: 16px;
  box-sizing: border-box;
}

.info-item.full-width {
  flex: 100%;
  min-width: 100%;
}

/* 标签与值样式 */
.info-label {
  width: 130px;
  color: #333;
  font-size: 14px;
  padding: 6px 0;
  text-align: right;
}

.info-value {
  flex: 1;
  color: #666;
  font-size: 14px;
  padding: 6px 0 0 14px;
  word-break: break-all;
}
</style>
